<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="/js/plugin/layui-v2.3.0/layui/css/layui.css">
	<link rel="stylesheet" href="/css/reset.css">
	<link rel="stylesheet" href="/css/index.css">
	<link rel="stylesheet" href="/css/project_set.css">
	<script src="/js/jquery-2.1.1.min.js"></script>
	<script src="/js/plugin/layui-v2.3.0/layui/layui.js"></script>
	<script src="/js/common.js"></script>
<style>
.layui-form-label{
	text-align:left
}
.kb-form-container{
	padding-left:20px;
}
.layui-form-item .layui-inline{
	margin-right:0px
}
</style>
</head>
<script type="text/javascript" th:inline="javascript">
	function initSelectTime(){
		var h = 0;
		for(var i=0;i < 49;i++){
			var val = ''; 
			if( i%2 == 0 ){
				h = parseInt(i/2) < 10 ? '0'+ parseInt(i/2) : parseInt(i/2);
				val = h+':00';
			}else{
				h = parseInt(i/2) < 10 ? '0'+ parseInt(i/2) : parseInt(i/2);
				val = h + ':30'
			}
			$("#startTime").append("<option value="+val+">"+val+"</option>");
			$("#endTime").append("<option value="+val+">"+val+"</option>");
			h = parseInt(h);
		}
		$("#startTime").val("09:00");
		$("#endTime").val("09:00");
	}
	
</script>
<body style="overflow-y:scroll">
<div class="addemployee-wrap" id="employee-wrap">
	<div class="kb-form-container" >
		<form class="layui-form" id="defaultForm" th:action="@{/app/customerdoorMap/update}" th:method="post" lay-filter="map-form">
			<input type="hidden" id="id" name="id" th:value="${record.id}" />
			<fieldset class="fieldset">
				<div class="layui-form-item">
				    <label class="layui-form-label"><span class="must-fill">*</span>会员</label>
				    <div class="layui-input-block">
				      	<select name="staffId" id="staffId" placeholder="选择会员" >
				      		<option value="">选择会员</option>
				      		<option th:each="staff : ${staffs}" th:value="${staff.id}" th:text="${staff.name}"></option>
					    </select>
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-inline">
					    <label class="layui-form-label"><span class="must-fill">*</span>开始日期</label>
				        <div class="layui-input-inline">
					      	<input type="text" name="startDay" id="startDay"  th:value="${#dates.format(record.startDay, 'yyyy-MM-dd')}" autocomplete="off" class="layui-input layui-date">
					    </div>
				    </div>
				    <div class="layui-inline">
					    <label class="layui-form-label">开始时间</label>
				        <div class="layui-input-block" >
						    <select id="startTime" name="startTime">
						        
						    </select>
						</div>
				    </div>
				</div>
				<div class="layui-form-item">
				    <div class="layui-inline">
					    <label class="layui-form-label"><span class="must-fill">*</span>结束日期</label>
				        <div class="layui-input-inline">
					      	<input type="text" name="endDay" id="endDay" th:value="${#dates.format(record.endDay, 'yyyy-MM-dd')}"placeholder="" autocomplete="off" class="layui-input layui-date">
					    </div>
				    </div>
				    <div class="layui-inline">
					    <label class="layui-form-label">结束时间</label>
				        <div class="layui-input-block" >
						    <select id="endTime" name="endTime">
						        
						    </select>
						</div>
				    </div>
				</div>
			</fieldset>
			<fieldset class="fieldset">	
				<div class="layui-form-item" style="">
				    <div class="layui-input-block">
				      <button class="layui-btn layui-btn-normal btn-bg" lay-submit lay-filter="formMap" id="submit-btn">提交</button>
				      <a class="layui-btn layui-btn-primary" onclick="closeLayer()">取消</a>
				    </div>
				</div>
			</fieldset>
		</form>	
	</div>
</div>
</body>
<script th:inline="javascript">
var laydate;
$(function(){
	initSelectTime();
	var record = [[${record}]];
	$("#endTime").val(record.endTime);
	$("#startTime").val(record.startTime);
	$("#staffId").val(record.staffId);
	layui.config({
	        base: '/js/plugin/layui-v2.3.0/layui/' //此处路径请自行处理, 可以使用绝对路径
	    }).extend({
	        formSelects: 'formSelects-v3'
	    }).use(['element',"layer","form",'formSelects','laydate'], function(){
			var layer=layui.layer,form = layui.form,formSelects = layui.formSelects,laydate=layui.laydate;
			//日期
			laydate.render({
			  elem: '.layui-date'
			});
			
			//监听提交
			  form.on('submit(formMap)', function(data){
				  $.post($("#defaultForm").attr('action'), data.field, function(result) {
						window.parent.layer.msg(result.msg);
						closeLayer();
					}, 'json');
					return false;
			  });
			
		});
})
</script>
</html>